// DLGDisPlayMeter.cpp : implementation file
//

#include "stdafx.h"
#include "gmp.h"
#include "DLGDisPlayMeter.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDLGDisPlayMeter dialog

CDLGDisPlayMeter::CDLGDisPlayMeter(CWnd* pParent /*=NULL*/)
	: CDialog(CDLGDisPlayMeter::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDLGDisPlayMeter)
	//}}AFX_DATA_INIT
}


void CDLGDisPlayMeter::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDLGDisPlayMeter)
	DDX_Control(pDX, IDC_SignalType, m_CSignalType);
	DDX_Control(pDX, IDC_EDIT1, m_vol);
	DDX_Control(pDX, IDC_CWKNOB1, m_cwknob1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDLGDisPlayMeter, CDialog)
	//{{AFX_MSG_MAP(CDLGDisPlayMeter)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDLGDisPlayMeter message handlers

BOOL CDLGDisPlayMeter::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CRect rect1;
	this->GetWindowRect (rect1);
	MoveWindow(0,100,rect1.right - rect1.left,rect1.bottom - rect1.top );

	m_VolData = 0;
	m_CurrentData = 0;
	m_singalType = "";
	m_range = 0;
	m_vol.SetWindowText ("");
	SetTimer(1,100,0);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDLGDisPlayMeter::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CNiColor col1(255,255,0);
	CString strTemp1;
	switch(nIDEvent)
	{
	case 1:
		if(m_VolData > 0)
			m_cwknob1.Value = m_VolData;
		if(m_range>0)
			m_cwknob1.Axis .Maximum = m_range;
		strTemp1.Format ("%.6f",m_VolData);
		m_vol.SetWindowText (strTemp1);

		m_CSignalType.SetWindowText(m_singalType);
		break;
	default:
		break;
	}
	CDialog::OnTimer(nIDEvent);
}

bool CDLGDisPlayMeter::SetValue(float vol,CString  singalType,float range)
{	
	m_VolData = vol;
	m_range = range;
	m_singalType = singalType;
	return 1;
}
